import { ApiCall } from "tsrpc";
import { ReqStop, ResStop } from "../../shared/master/PtlStop";
import { player } from "../../model/fight/body/player";
import god from "../../god";
import app, { xlsxCfgNames } from "../../app";
import { template } from "../../shared/master/MsgAction";
import manage_user from "../model/manage/manage_user";
import logic from "../logic";

export default async function (call: ApiCall<ReqStop, ResStop>) {
    call.succ({})

    let user = call.req._player as player;
    
    if(!app.getCfg(xlsxCfgNames.调试id).has(user.uuid)){
        return;
    }
    user.sendMsg(template.default,'开始停服')
    manage_user.sendAllMsg(template.default,'服务器暂时关闭,具体关闭原因请查看Q群550620904')
    setTimeout(()=>{
        logic.stop = true;
        user.sendMsg(template.default,'开始离线')
        manage_user.offAll()
    },5000)
}